home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group00b.txt / 000093_icon-group-sender_Mon Oct 23 16:58:14 2000.msg < prev    next >
Internet Message Format  |  2001-01-03  |  2KB

  1. Return-Path: <icon-group-sender>
  2. Received: (from root@localhost)
  3.     by baskerville.CS.Arizona.EDU (8.11.1/8.11.1) id e9NNw0X05043
  4.     for icon-group-addresses; Mon, 23 Oct 2000 16:58:00 -0700 (MST)
  5. Message-Id: <200010232358.e9NNw0X05043@baskerville.CS.Arizona.EDU>
  6. Date: Mon, 23 Oct 2000 16:20:42 -0500
  7. From: "Charles Hethcoat" <CHETHCOA@oss.oceaneering.com>
  8. To: "Parvinder Kaur" <kaurp@cs.ucdavis.edu>
  9. Cc: <icon-group@cs.arizona.edu>
  10. Subject: Re: Icon beginner
  11. Content-Disposition: inline
  12. X-Guinevere: 1.0.13 ; Oceaneering Int'l
  13. X-MIME-Autoconverted: from quoted-printable to 8bit by baskerville.CS.Arizona.EDU id e9NLJw300124
  14. Errors-To: icon-group-errors@cs.arizona.edu
  15. Status: RO
  16. Content-Length: 866
  17.  
  18. Not the only way, or the best way, but it works:
  19.  
  20. procedure main()
  21.     wsp := ' '  # a whitespace cset
  22.     s_in := "Pretty little maids all in a row."
  23.     s_out := ""
  24.     
  25.     s_in ? {
  26.         while s_out ||:= tab(upto(wsp)) do
  27.             tab(many(wsp))
  28.         s_out ||:= tab(0)
  29.     }
  30.     write(s_in, "\n-->", s_out)
  31.     exit()
  32. end
  33.  
  34. It should give:
  35.  
  36. Pretty little maids all in a row.
  37. -->Prettylittlemaidsallinarow.
  38.  
  39. You can also change the cset to recognize tabs and such:
  40.  
  41. wsp := ' \t'
  42.  
  43. Charles Hethcoat
  44.  
  45. >>> Parvinder Kaur <kaurp@cs.ucdavis.edu> 00-10-23 1:56:42 PM >>>
  46. Hi, 
  47.   I'm just learning icon and I'm stumped with a particular problem.  I'm
  48. suppose to delete all occurrences of a space from a sentence, i.e. "Hi
  49. there" should become "Hithere".  Any ideas of how I should approach this
  50. problem.  I tried using the built-in delete proc. but it wasn't working.
  51. I'd appreciate any help, thanks!
  52. -Cos
  53.  
  54.  
  55.  
  56.